var dbCon=null;

function openDB() {
	try {
    	if (window.openDatabase) {
        	dbCon = openDatabase("testDB4", "1.0", "HTML5 Database", 1024*1024);
        	if (!dbCon) {
            	alert("Failed to open the database");
            	return;
            }
    	} else {
        	alert("Failed to open the database(HTML5 not supported)");
        	return;
        }
	} catch(err) { 
	 if (err == 2) {  
            // Version number mismatch.  
            console.log("Invalid database version.");  
        } else {  
            console.log("Unknown error "+err+".");  
        }  
        return; 
	}
}

function executeSql(sql,params) {
	dbCon.transaction(function(tx)
    {
         tx.executeSql(sql,params);
    });
}

function checkTable() {
	var sql = "create table if not exists tb_board ("
                      + "idx integer primary key,"
                      + "subject varchar(255), "
                      + "content text, "
                      + "reg_date datetime"
                      + ")";
        
    executeSql(sql,[]);
}


